<script setup>
	import {
		provide,
		ref,
		defineExpose
	} from 'vue';
	import {
		onLaunch,
		onShow,
		onError
	} from '@dcloudio/uni-app';

	// 状态栏高度
	const statusBarHeightTop = ref("");

	// 胶囊的相关数据
	const capsuleData = ref("");

	// 定义全局变量
	const globalData = ref({
		appUrl: "https://min.yayixun.top/",
		barTop: "",
		capsuleData: "",
		imgOssUrl: "http://yyx-web-oss.oss-cn-beijing.aliyuncs.com"
	})


	onLaunch(() => {
		// uni.setStorageSync("token", "e06d5e79cb5a425ba1e62efd401c55d2")
		// 状态栏的高度
		// #ifdef APP-PLUS
		// console.log("uni.getSystemInfoSync()", uni.getSystemInfoSync().statusBarHeight);
		statusBarHeightTop.value = uni.getSystemInfoSync().statusBarHeight;

		globalData.value.barTop = statusBarHeightTop.value;
		// #endif

		// 小程序胶囊的数据
		// #ifdef  MP
		capsuleData.value = uni.getMenuButtonBoundingClientRect();

		// 小程序胶囊上面的高度
		globalData.value.barTop = capsuleData.value.top + statusBarHeightTop.value;

		// 全局设置胶囊的相关数据
		globalData.value.capsuleData = capsuleData.value;
		// #endif




	});




	//  通过provide进行数据传递
	provide('globalData', globalData);

	defineExpose({
		globalData
	})
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "uview-plus/index.scss";

	/* 自定义公共css */
	@import "common/common.scss";

	uni-page-body {
		height: 100%;
	}
</style>